<?php


class SubscriberTransaction extends CActiveRecord
{
	
	public static function model($Vgmajjibziuy=__CLASS__)
	{
		return parent::model($Vgmajjibziuy);
	}

	
	public function tableName()
	{
		return 'subscriber_transaction';
	}

	
	public function rules()
	{
		
		
		return array(
			array('subscriber_id', 'required'),
			array('service_id, subscriber_id, status, purchase_type', 'numerical', 'integerOnly'=>true),
			array('cost', 'numerical'),
			array('service_number, error_code', 'length', 'max'=>20),
			array('channel_type, event_id', 'length', 'max'=>10),
			array('description', 'length', 'max'=>150),
			array('create_date', 'safe'),
			
			
			array('id, service_id, subscriber_id, status, create_date, service_number, cost, channel_type, purchase_type, error_code, event_id, description', 'safe', 'on'=>'search'),
		);
	}

	
	public function relations()
	{
		
		
		return array(
			'service' => array(self::BELONGS_TO, 'Service', 'service_id'),
			'subscriber' => array(self::BELONGS_TO, 'Subscriber', 'subscriber_id'),
		);
	}

	
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'service_id' => 'Service',
			'subscriber_id' => 'Subscriber',
			'status' => 'Status',
			'create_date' => 'Create Date',
			'service_number' => 'Service Number',
			'cost' => 'Cost',
			'channel_type' => 'Channel Type',
			'purchase_type' => 'Purchase Type',
			'error_code' => 'Error Code',
			'event_id' => 'Event',
			'description' => 'Description',
		);
	}

	
	public function search()
	{
		
		

		$V0v5vsnfxezw=new CDbCriteria;

		$V0v5vsnfxezw->compare('id',$this->id,true);
		$V0v5vsnfxezw->compare('service_id',$this->service_id);
		$V0v5vsnfxezw->compare('subscriber_id',$this->subscriber_id);
		$V0v5vsnfxezw->compare('status',$this->status);
		$V0v5vsnfxezw->compare('create_date',$this->create_date,true);
		$V0v5vsnfxezw->compare('service_number',$this->service_number,true);
		$V0v5vsnfxezw->compare('cost',$this->cost);
		$V0v5vsnfxezw->compare('channel_type',$this->channel_type,true);
		$V0v5vsnfxezw->compare('purchase_type',$this->purchase_type);
		$V0v5vsnfxezw->compare('error_code',$this->error_code,true);
		$V0v5vsnfxezw->compare('event_id',$this->event_id,true);
		$V0v5vsnfxezw->compare('description',$this->description,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$V0v5vsnfxezw,
		));
	}
}